package cn.owng.server.platform;

import cn.owng.server.common.ImportCommon;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

/**
 * 微信公众号请关注: 开源螺丝钉
 * <br>
 * 码云请关注: <a href="https://gitee.com/xiyoufang">https://gitee.com/xiyoufang</a>
 * <br>
 * 哔哩哔哩请关注: <a href="https://space.bilibili.com/438927834">https://space.bilibili.com/438927834</a>
 *
 * @author xiyoufang
 */
@Slf4j
@SpringBootApplication
@Import(ImportCommon.class)
public class PlatformApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(PlatformApplication.class, args);
        String port = applicationContext.getEnvironment().getProperty("server.port");
        String contextPath = applicationContext.getEnvironment().getProperty("server.servlet.context-path");
        log.info("URL: {}:{}{}", "http://127.0.0.1", port, StringUtils.defaultIfBlank(contextPath, ""));
    }
}
